*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: linear-gradient(160deg, #2bc0e4, #eaecc6);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #333;
}

.game-wrapper {
  width: min(960px, 95vw);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
  padding: 24px 32px 32px;
  backdrop-filter: blur(8px);
}

.game-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.game-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  text-align: center;
  color: #1b2671;
}

.game-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.stats strong {
  color: #ff6f61;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions button {
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #5a60ff, #7f9cff);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 14px rgba(90, 96, 255, 0.35);
}

.actions button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.game-main {
  position: relative;
}

.board {
  display: grid;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  background: rgba(27, 38, 113, 0.08);
  border-radius: 16px;
  position: relative;
}

.tile {
  width: clamp(48px, 8vw, 70px);
  aspect-ratio: 1;
  border: none;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
  position: relative;
}

.tile[disabled] {
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}

.tile.selected {
  background: linear-gradient(135deg, #ffd166, #f99e4c);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(249, 158, 76, 0.5);
}

.tile.hint {
  animation: hint-breathe 1s ease-in-out infinite alternate;
}

@keyframes hint-breathe {
  from {
    box-shadow: 0 0 0 rgba(255, 198, 110, 0.65);
  }
  to {
    box-shadow: 0 0 18px rgba(255, 198, 110, 0.85);
  }
}

.path-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.message-modal {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
  gap: 16px;
  animation: fade-in 0.2s ease;
}

.message-modal h2 {
  margin: 0;
  color: #3b3b98;
}

.message-modal button {
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #38ada9, #78e08f);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(56, 173, 169, 0.4);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .stats {
    justify-content: center;
  }

  .actions {
    justify-content: center;
  }
}

